﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Netfraction.Hub.Scripting
{
    internal static class Global
    {
        #region GetAppDir

        /// <summary>
        /// Gets the name of the product.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <returns></returns>
        public static string GetProductName(Assembly assembly)
        {
            string productName = "";

            if (Attribute.IsDefined(assembly, typeof(AssemblyProductAttribute)))
            {
                AssemblyProductAttribute asProductName = (AssemblyProductAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyProductAttribute));
                productName = asProductName.Product;
            }

            return productName;
        }

        /// <summary>
        /// Gets the assembly company.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <returns></returns>
        public static string GetAssemblyCompany(Assembly assembly)
        {
            string company = "";

            if (Attribute.IsDefined(assembly, typeof(AssemblyCompanyAttribute)))
            {
                AssemblyCompanyAttribute ascompany = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute));
                company = ascompany.Company;
            }

            return company;
        }
        #endregion

    }
}
